package com.effect.part1_ObjectCrateDestroy.item3;

/**
 * Created by jon on 17-10-7.
 */

//Singleton with static factory
public class Elvis_02 {
    private  static final  Elvis_02 INTANCE = new Elvis_02();
    private  Elvis_02(){
    }
    public  static  Elvis_02 getInstance(){
        return  INTANCE;
    }
    public void leaveTheBuilding(){

    }

    //readResolve method to preserve singleton property
    private Object readResolve(){
        //Return the one true Elvis and let the garbage collector
        //take care of the Elvis impersonator.
        return  INTANCE;
    }
}
